import 'package:flutter/cupertino.dart';
import 'package:get_storage/get_storage.dart';

import '../generated/l10n.dart';

class LocalModel extends ChangeNotifier {
  Locale _locale = const Locale('zh', 'UG');

  getLocale() {
    final box = GetStorage();
    String? language = box.read("language");
    print("LocalModal----${language}");

    print(_locale);
    return _locale;
  }

  void local(Locale locale) async {
    final box = GetStorage();
    if (locale != _locale) {
      print("LocalModal1");
      print(locale);
//locale.toString().val("language");
      await box.write("language", locale.toString());
      _locale = locale;
      S.load(locale);
      notifyListeners();
    }
  }

  bool isRTL() {
    return _locale.countryCode == 'UG';
  }
}
